home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmulticastsocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.3 KB  |  114 lines

  1. /*  -*- C++ -*-
  2.  *  Copyright (C) 2003 Thiago Macieira <thiago.macieira@kdemail.net>
  3.  *
  4.  *
  5.  *  Permission is hereby granted, free of charge, to any person obtaining
  6.  *  a copy of this software and associated documentation files (the
  7.  *  "Software"), to deal in the Software without restriction, including
  8.  *  without limitation the rights to use, copy, modify, merge, publish,
  9.  *  distribute, sublicense, and/or sell copies of the Software, and to
  10.  *  permit persons to whom the Software is furnished to do so, subject to
  11.  *  the following conditions:
  12.  *
  13.  *  The above copyright notice and this permission notice shall be included 
  14.  *  in all copies or substantial portions of the Software.
  15.  *
  16.  *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17.  *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18.  *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19.  *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20.  *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21.  *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22.  *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  */
  24.  
  25. #ifndef KMULTICASTSOCKET_H
  26. #define KMULTICASTSOCKET_H
  27.  
  28. #include "kdatagramsocket.h"
  29. #include "kmulticastsocketdevice.h"
  30.  
  31. namespace KNetwork {
  32.  
  33. class KMulticastSocketPrivate;
  34. /**
  35.  * @class KMulticastSocket kmulticastsocket.h kmulticastsocket.h
  36.  * @brief A multicast-capable datagram socket class
  37.  *
  38.  * This class derives from @ref KDatagramSocket adding methods to it to
  39.  * allow better control over the multicast functionality. In special,
  40.  * the join and leave group functions are added.
  41.  *
  42.  * Other more low-level options on multicast sockets can be accessed
  43.  * directly with the @ref KMulticastSocketImpl class returned by 
  44.  * @ref multicastSocketDevice.
  45.  *
  46.  * @author Thiago Macieira <thiago.macieira@kdemail.net>
  47.  */
  48. class KDECORE_EXPORT KMulticastSocket: public KDatagramSocket
  49. {
  50.   // Q_add-it-here_OBJECT
  51. public:
  52.   /**
  53.    * Constructor.
  54.    */
  55.   KMulticastSocket(QObject* parent = 0L, const char *name = 0L);
  56.  
  57.   /**
  58.    * Destructor.
  59.    */
  60.   ~KMulticastSocket();
  61.  
  62.   /**
  63.    * Returns the multicast socket device in use by this object.
  64.    *
  65.    * @note The returned object can be null.
  66.    */
  67.   KMulticastSocketImpl* multicastSocketDevice();
  68.  
  69.   /**
  70.    * @overload
  71.    */
  72.   const KMulticastSocketImpl* multicastSocketDevice() const;
  73.  
  74.   /**
  75.    * Joins a multicast group. The group to be joined is identified by the 
  76.    * @p group parameter.
  77.    *
  78.    * @param group    the multicast group to join
  79.    * @returns true on success
  80.    */
  81.   virtual bool joinGroup(const KSocketAddress& group);
  82.  
  83.   /**
  84.    * @overload
  85.    * Joins a multicast group. This function also specifies the network interface
  86.    * to be used.
  87.    */
  88.   virtual bool joinGroup(const KSocketAddress& group, 
  89.              const KNetworkInterface& iface);
  90.  
  91.   /**
  92.    * Leaves a multicast group. The group being left is given by its address in the
  93.    * @p group parameter.
  94.    *
  95.    * @param group    the group to leave
  96.    * @returns true on successful leaving the group
  97.    */
  98.   virtual bool leaveGroup(const KSocketAddress& group);
  99.  
  100.   /**
  101.    * @overload
  102.    * Leaves a multicast group.
  103.    */
  104.   virtual bool leaveGroup(const KSocketAddress& group,
  105.               const KNetworkInterface& iface);
  106.  
  107. private:
  108.   KMulticastSocketPrivate *d;
  109. };
  110.  
  111. }                // namespace KNetwork
  112.  
  113. #endif
  114.